/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package API;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;

/**
 *
 * @author mrbao
 */
public class Title extends Item {

    public Title(String text, int width) {
        this.text = text;
        this.width = width;
        font = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
        colorText = 0xffffff;
    }

    public int getHeight() {
        return font.getHeight();
    }

    public void Paint(Graphics g) {
        Gradient.DrawGradientBox(g, 0, 0, width, font.getHeight());
        g.setFont(font);
        g.setColor(colorText);
        g.drawString(text, (width - font.stringWidth(text)) / 2, 0, 0);
    }
}
